package goose

import (
	"gitee.com/crack007/goose/gscore"
	"github.com/spf13/cobra"
)

type ModuleBuilder struct {
	use      string
	short    string
	example  string
	cobraCmd *cobra.Command
}

func NewModuleBuilder(builder gscore.IBuilder) *ModuleBuilder {
	return &ModuleBuilder{cobraCmd: buildModuleCmd(builder)}
}

func (x *ModuleBuilder) Use() string {
	return x.use
}

func (x *ModuleBuilder) SetName(use string) *ModuleBuilder {
	x.use = use
	return x
}

func (x *ModuleBuilder) Short() string {
	return x.short
}

func (x *ModuleBuilder) SetDesc(short string) *ModuleBuilder {
	x.short = short
	return x
}

func (x *ModuleBuilder) Example() string {
	return x.example
}

func (x *ModuleBuilder) SetExample(example string) *ModuleBuilder {
	x.example = example
	return x
}

func (x *ModuleBuilder) Build() *cobra.Command {
	x.cobraCmd.Use = x.use
	x.cobraCmd.Short = x.short
	x.cobraCmd.Example = x.example
	return x.cobraCmd
}
